<template>
  <div>
    <el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px">
      <el-form-item label="会员协议" prop="infosys_content">
        <quilleditor v-model="form.infosys_content" />
      </el-form-item>
      <el-form-item style="margin-top: 12px;">
        <el-button type="primary" @click="setData">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import quilleditor from 'components/quilleditor';
import memberComboAPI from 'api/memberManagement/memberComboAPI';

export default {
  components: {
    quilleditor
  },
  props: ['type'],
  data() {
    return {
      form: {
        infosys_content: ''
      },
      rules: {
        infosys_content: [
          { required: true, message: '请输入会员协议', trigger: 'blur' }
        ]
      },
      content: ''
    };
  },
  methods: {
    async setData() {
      await this.$refs.ruleForm.validate()
      await memberComboAPI('modifyMemberAgreement', {...this.form})
      this.$message.success('编辑成功')
    },
    async getData() {
      let res = await memberComboAPI('getMemberAgreement')
      this.form = res.rData[0]
    },
  },
  mounted() {
    this.getData()
  }
};
</script>

<style lang="scss" scoped></style>
